home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
comm
/
ca29_3.zip
/
FILEMGR.CMD
< prev
next >
Wrap
OS/2 REXX Batch file
|
1992-03-23
|
24KB
|
839 lines
SET TTHRU OFF ; Make first to allow typeahead
S15 = "INTERNAL" ; Set your word processor name here
; ; .. "INTERNAL" -> Use COM-AND's internal editor
; ----- FileMgr: File manager shell for COM-AND
;
; R.McG; 7/89, Chicago
; updated: 3/92 (to use COM-AND's internal editor)
; ----------------------------------------------------------------
; Note: You should change the second line above to specify the
; name of the word processor you typically use. When invoked
; the file name to be edited is appended to the program name,
; (e.g. equivalend to "d> PE file.txt"). If this is not appro-
; priate, you must change the logic at the end of this script.
; ----------------------------------------------------------------
; Usages:
; S19 -----> Legend line
; S18 -----> Load-time drive:subdirectory (for exit)
; S17 -----> Load-time download d:subdir (for exit)
; S16 -----> Current file mask (for DIR function)
; S15 -----> Editor or wordprocessor program file name
;
; N99 -----> Number of lines on screen
; N92 -----> Current cursor
; N91 -----> Current cursor
; N90 -----> Current screen highlight (1 to N99-6)
;
; FLAG(2) -> Off if we are on left side of the display
; -----------------------------------------------------------------------
;
; Initialization
;
CURSOR N91,N92 ; Read current cursor
S19 = "FileMgr ver 1.0 " ; 20 chars long
LEGEND S19 ; Set initial legend
SUBDIR S18 ; Read current subdir
DLDIR S17 ; Read current download subdir
SSIZE N99 ; get current screen size
SAVE 0,0,N99-2,79 ; Save original screen
ON ESCAPE GOSUB ESCAPE ; Escape action
S16 = "*.*" ; Set default mask
;
; Ask for a directory change, and then start
;
GOSUB Ask_Dir ; Ask for a directory change
GOTO START ; And continue
;
; Escape - Clear all windows, and exit
;
Escape:
SET DLDIR S17 ; Reset DLDIR to load time
CHDIR S18 ; Reset default subdir to load time
RESTORE ; Restore screen
LOCATE N91,N92 ; Restore cursor
EXIT ; End script
;
; Draw the screen, and decide if we're linked
;
Start:
GOSUB Screen ; Draw screen
GOSUB DispFirst ; Build our directory list
N90 = 1 ; Set initial cursor
SET FLAG(2) OFF ; On Left of display
GOSUB Set_Cursor ; Set 1st cursor
;
; We have a keypress pending
;
Main:
KEYGET S1 ; Read a single key
SWITCH S1
CASE "4D00" ; Cursor_Right
GOSUB Change_Sides
ENDCASE
CASE "4B00" ; Cursor left
GOSUB Change_Sides
ENDCASE
CASE "4900" ; PgUp
GOSUB Prev_Page
ENDCASE
CASE "5100" ; PgDn
GOSUB Next_Page
ENDCASE
CASE "4700" ; Home
GOSUB Home_Page
ENDCASE
CASE "4F00" ; End
GOSUB End_Page
ENDCASE
CASE "4800" ; Cursor Up
GOSUB Cursor_Up
ENDCASE
CASE "5000" ; Cursor down
GOSUB Cursor_Down
ENDCASE
CASE "7100" ; Alt-F10
SHELL
ENDCASE
CASE "5200" ; INS key
GOSUB DOS
ENDCASE
CASE "N" ; Change directory
GOSUB NewDir
ENDCASE
CASE "U" ; Upload a file
GOSUB Upld
ENDCASE
CASE "H" ; Help
GOSUB Help
ENDCASE
CASE "S" ; Send
GOSUB Send
ENDCASE
CASE "F" ; Free space
GOSUB Free
ENDCASE
CASE "V" ; View a file
GOSUB View
ENDCASE
CASE "W" ; Wordprocessor
GOSUB Word
ENDCASE
CASE "E" ; Execute a program
GOSUB EXEC
ENDCASE
CASE "C" ; Copy a file
GOSUB Copy
ENDCASE
CASE "D" ; Delete a file
GOSUB Delete
ENDCASE
CASE "R" ; Rename
GOSUB Rename
ENDCASE
CASE "M" ; New mask
GOSUB Mask
ENDCASE
DEFAULT
SOUND 100,100 ; Signal displeasure
ENDCASE
ENDSWITCH
GOTO Main ; And continue
;
; ----- Subroutine: Read the line at the current highlight
; .. according to the current seting of FLAG(2)
; S12 returns the line at the current cursor
;
Read_Cursor:
S12 = ""
IF NOT ZERO N90
IF FLAG(2) ; IF true we're on Remote
ATSCR N90,41,37 S12
ELSE
ATSCR N90, 2,37 S12
ENDIF
ENDIF
RETURN
;
; ----- Subroutine: Clear the current highlight
; .. according to the current setting of FLAG(2)
;
Clear_Cursor:
IF NOT ZERO N90
GOSUB Read_Cursor
IF FLAG(2) ; IF true we're on remote
ATSAY N90,41 (default) S12
ELSE
ATSAY N90, 2 (default) S12
ENDIF
ENDIF
RETURN
;
; ----- Subroutine: Display the current highlight
; .. according to the current stting of FLAG(2)
;
Set_Cursor:
GOSUB Read_Cursor
IF NOT ZERO N90
IF FLAG(2) ; IF true we're on remote
IF NOT NULL S12
ATSAY N90,41 (contrast) S12
ELSE
N90 = N90-1
GOTO Set_Cursor
ENDIF
ELSE ; On own side
IF NOT NULL S12
ATSAY N90, 2 (contrast) S12
ELSE
N90 = N90-1
GOTO Set_Cursor
ENDIF
ENDIF
ENDIF
RETURN
;
; ----- Subroutine: Move the cursor Up
;
Cursor_Up:
GOSUB Clear_Cursor
IF GT N90 1
N90 = N90-1
ELSE
N90 = N99-6
ENDIF
GOSUB Set_Cursor
RETURN
;
; ----- Subroutine: Move the cursor Down
;
Cursor_Down:
GOSUB Clear_Cursor
IF LT N90 (N99-6)
N90 = N90+1
ELSE
N90 = 1
ENDIF
GOSUB Set_Cursor
RETURN
;
; ----- Subroutine: Change the display side
;
Change_Sides:
GOSUB Clear_Cursor ; Clear cursor if any
IF FLAG(2) ; IF true we're on right
SET FLAG(2) OFF ; .. make it left
ELSE ; etc
SET FLAG(2) ON
ENDIF
GOSUB Set_Cursor ; And renew cursor
RETURN
;
; ----- Subroutine: Clear a window - right or left
; .. according to the current stting of FLAG(2)
;
Clear_Window:
IF FLAG(2) ; IF true we're on remote
SCROLL 0,1,40,(N99-6),77 (default)
ELSE
SCROLL 0,1,1,(N99-6),38 (default)
ENDIF
N90 = 0 ; Clear current cursor
RETURN
;
; ----- Subroutine: Display the previous page
;
Prev_Page:
SOUND 55,500 ; Unimplemented
RETURN
;
; ----- Subroutine: Display the next page
;
Next_Page:
GOSUB DispNext ; Display next page
N90 = 1 ; Set initial cursor
SET FLAG(2) OFF ; On Left of display
GOSUB Set_Cursor ; And reset cursor
RETURN
;
; ----- Subroutine: Set to the home page
;
Home_Page:
GOSUB DispFirst ; Display first page
N90 = 1 ; Set initial cursor
SET FLAG(2) OFF ; On Left of display
GOSUB Set_Cursor ; And reset cursor
RETURN
;
; ----- Subroutine: Find the ending page
;
End_Page:
SOUND 55,500 ; Unimplemented
RETURN
;
; ----- Subroutine: Display first page of directory
;
DispFirst:
FFIRST S16 ; Initialize
IF Failure ; If not found
RETURN ; Quit here
ENDIF
;
; ----- Subroutine: Display directory using current position
; Note: Cursor is repositioned to top left
;
DispNext:
N90 = 1 ; Clear current cursor
SET FLAG(2) ON ; Clear right side
GOSUB Clear_Window ; ..
SET FLAG(2) OFF ; Clear left side
GOSUB Clear_Window ; ..
N1 = 1 ; Set loop counter
;
; Read and display the file names
;
DINE100:
FNEXT S1 ; Get next file name
IF Failure ; If end of list
IF LE N1 1 ; If empty screen
GOTO DispFirst ; Restart
ENDIF
RETURN ; Else, quit
ENDIF
;
; Skip subdirectory files
;
IF STRCMP S1(1:1) "." ; Skip parent subdir
GOTO DINE100 ; SKip this file
ENDIF
;
; Skip subdirectories
;
FATTR S2 S1 ; Get attribute
IF STRCMP S2(3:3) "1" ; If a subdirectory
GOTO DINE100 ; Goto endloop
ENDIF
;
; Get remaining information and build the display line
;
FSIZE S2 S1 ; Get file size
FDATE S3 S1 ; Get file date
FTIME